<#include "../macro/layout_default.ftl"/>

<@head>
<link rel="stylesheet" href="/misc/app/css/authorize.css"/>
</@head>
<@body>
<script src="/misc/app/js/authorize.js"></script>
<script> staffId = ${staff.id}</script>
</@body>

<#macro tree datalist>
    <#list datalist as item>
      	 <#if (item.id != 900 ) && (item.id != 90) && (item.id != 91) && (item.id != 92) &&  (item.id != 21)> 
    	
    	
		        <#if (item.children?size > 0)>
		        <li class="authtree-node ${item.mark?string("active","")}" name="authtree_node">
		            <div><input type="checkbox" name="authtree_node_checker" id="${item.id}" value="${item.id}" <#if item.mark>checked="checked"</#if>/> <label for="${item.id}">${item.name}</label><#if ((item.desc!)?length>0)> - <span class="text-muted text-sm">${item.desc}</span></#if></div>
		            <ul>
		                <@tree item.children></@tree>
		            </ul>
		        </li>
		        <#else>
		        <li class="authtree-node ${item.mark?string("active","")}" name="authtree_node">
		            <div><input type="checkbox" name="authtree_node_checker" id="${item.id}" value="${item.id}" <#if item.mark>checked="checked"</#if>/> <label for="${item.id}">${item.name}</label><#if ((item.desc!)?length>0)> - <span class="text-muted text-sm">${item.desc!}</span></#if></div>
		        </li>
		    </#if> 
	        
        </#if>
    </#list>
</#macro>

<@layout_default>
<div class="box">
    <div class="box-header with-border">
        <img class="img-circle pull-left" src="/misc/app/img/head.png" style="width: 40px;height: 40px;margin-right: 10px"/>
        <div class="text-bold">${staff.account}</div>
        <div class="text-muted">${staff.companyName}</div>
    </div>
    <div class="box-body">
        <div class="authtree" id="authtree">
            <ul>
                <@tree resTree></@tree>
            </ul>
        </div>
    </div>
    <div class="box-footer">
        <button class="btn btn-warning" name="btn_save_auth">保存权限</button>
        <a href="javascript:history.back()" class="btn btn-default">返回</a>
        <span class="text-muted"><i class="fa fa-info-circle text-yellow"></i> 权限更新后，账户需要重新登录才能生效</span>
    </div>
</div>
</@layout_default>